#include<bits/stdc++.h>

using namespace std;
struct Point {
    int x;
    int y;
} points[1000];
int n;
Point center = {50, 50};

bool cmp(Point p, Point q) {
    //return p.x<q.x;
    double pc = hypot(p.x - center.x, p.y - center.y);
    double qc = hypot(q.x - center.x, q.y - center.y);
    return pc < qc;

}

int main() {
    freopen("wechat.in", "r", stdin);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> points[i].x >> points[i].y;
    }
    sort(points, points + n, cmp);

    for (int i = 0; i < n; i++) {
        cout << points[i].x << " " << points[i].y << endl;
    }
    return 0;
}
